<template>
  <div>
    <el-table
      v-loading="listLoading"
      :data="list"
      :element-loading-text="elementLoadingText"
    >
      <el-table-column
        align="center"
        v-if="activeName == 0"
        :prop="'ecname'"
        label="规则名称"
        min-width="80"
      ></el-table-column>

      <el-table-column
        align="center"
        v-if="activeName == 1"
        :prop="'olname'"
        label="规则名称"
        min-width="80"
      ></el-table-column>

      <el-table-column
        align="center"
        v-if="activeName == 2"
        :prop="'rlname'"
        label="规则名称"
        min-width="80"
      ></el-table-column>

      <el-table-column
        align="center"
        v-if="activeName == 3"
        :prop="'elname'"
        label="规则名称"
        min-width="80"
      ></el-table-column>

      <el-table-column
        align="center"
        v-if="activeName == 4"
        :prop="'mlname'"
        label="规则名称"
        min-width="80"
      ></el-table-column>

      <el-table-column
        align="center"
        v-if="activeName == 5"
        :prop="'mlname'"
        label="规则名称"
        min-width="80"
      ></el-table-column>

      <el-table-column align="center" label="备注" min-width="380">
        <template #default="{ row }">
          <div>{{ row.status_text }}</div>
        </template>
      </el-table-column>
      <el-table-column align="center" prop="intro" label="操作" min-width="120">
        <template #default="{ row }">
          <el-button type="text" @click="handleEdit(row)">编辑</el-button>
          <el-button type="text" @click="handleDelete(row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
  export default {
    props: {
      activeName: {
        type: String,
        defaule: 0,
      },
      loading: {
        type: Boolean,
        default: false,
      },
      list: {
        type: Array,
        default() {
          return []
        },
      },
    },
    model: {
      prop: 'loading',
    },
    watch: {
      listLoading(val) {
        this.$emit('input', val)
      },
      loading(val) {
        this.listLoading = val
      },
    },
    data() {
      return {
        listLoading: false,
        shotable: true,
        elementLoadingText: '正在加载...',
      }
    },
    methods: {
      handleEdit(row) {
        this.$emit('handleEdit', row)
      },
      handleDelete(row) {
        this.$emit('handleDelete', row)
      },
    },
  }
</script>
